<!DOCTYPE html>
<html>
{include file="head.html"}
<body>
<div class="body">
<div class="header">
    <a href="{$appkoudai}?m=koudai_product&a=order"  class="left-btn"><span class="iconfont icon-back"></span></a>
    <div class="title">添加产品</div>
      <div class="right-btn" id="showSearch"><span class="iconfont icon-search"></span></div>
  </div>
<div class="main-body ">
	 <div class="tabs-border">
     	{foreach item=c from=$kucunlist}
        <a href="{$appkoudai}?m=koudai_product&a=add&kcid={$c.kcid}" class="item {if $c.kcid eq get('kcid')}active{/if}">{$c.title}</a>
        {/foreach}
     </div>
     <div class="pd-5" id="searchBox" style="display:none">
<form method="get" action="{$appkoudai}">
<input type="hidden" name="m" value="koudai_product" />
<input type="hidden" name="a" value="add" />
<input type="hidden" name="kcid" value="{$smarty.get.kcid}">

<div class="input-row">
  <label >产品名称</label>
  <input type="text" name="keyword" value="{$smarty.get.keyword}" />
</div>
<div class="form-btns">
  <button type="submit"   class="btn btn-warning btn-row"  >
  搜索
  </button>
</div>
</form>
</div>
    <style>
 	 
		.plist .item .num{width:30px; margin-right:10px; height:20px;}
		.plist .item .catid{width:90px; margin-right:10px; height:22px;}
    </style>
    <div class="plist">
    	{get data=catlist model=koudai_category fun=id_title(array("where"=>"siteid=".SITEID." AND status < 8 "))}
    	{foreach item=c from=$kclist}
        <div class="item">
        	<div class="g-sd1">
            	<img src="{$c.imgurl|images_site}.100x100.jpg">
                  
            </div>
            <div class="g-mn1">
            	<div class="g-mn1c">
                	<div class="title">{$c.title}</div>
                    <div>{$c.kc_title}</div>
                    <div class="row-price">
                    	<span>库存：{$c.total_num}</span> 
                        <span>销量：{$c.buy_num}</span> 
                        <span>￥{$c.price}元</span>                         
                        </div>
                     {if $c.koudai}   
                    <div class="row-price">
                    	<span>口袋库存：{$c.ym_total_num}</span>
                        <span>口袋销量：{$c.ym_buy_num}</span>
                    </div>
                    {/if}                      
                    <div class="pro">
                    <select  class="catid">
                    	<option value="0">请选择</option>
                    	{foreach item=cat key=catkey from=$catlist}
                    	<option value="{$catkey}" {if $c.ym_catid eq $catkey} selected{/if}>{$cat}</option>
                       {/foreach}
                    </select>
                    <input type="hidden" class="num" value="1">
                    <a href="javascript:;" productid="{$c.id}" kcid="{$c.kcid}" class="btn  btn-small btn-success addProduct" url="{$appkoudai}?m=koudai_product&a=addProduct&productid={$c.id}&ajax=1">添加</a></div>
                </div>
               
            </div>
             <div class="clearfix"></div>
        </div>
    	{/foreach}
    </div>

	 
</div>
<script>
$(function(){
	$("#showSearch").on(CLICK,function(){
		$("#searchBox").toggle();
	});
	$(document).on("click",".addProduct",function(){
		var obj=$(this);
		$.get("{$appkoudai}?m=koudai_product&a=addProduct&ajax=1&productid="+$(this).attr("productid")+"&kcid="+$(this).attr("kcid")+"&total_num="+$(this).siblings(".num").val()+"&catid="+$(this).siblings(".catid").val(),function(data){
			skyToast(data.message);
		},"json");
		
	});
});
</script>  
</div>

</div> 
{include file='footer.html'}